package org.jeecg.modules.platform.organization.controller;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.ServiceNameConstants;
import org.jeecg.common.system.api.entity.SysPermission;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.platform.api.PlatformOrganizationPermissionApi;
import org.jeecg.modules.platform.entity.CyPlatformOrganizationPermission;
import org.jeecg.modules.platform.organization.service.ICyPlatformOrganizationPermissionService;
import org.jeecg.modules.system.service.ISysPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description: 组织权限
 * @Author: jeecg-boot
 * @Date: 2024-10-28
 * @Version: V1.0
 */
@Api(tags = "组织权限")
@RestController
@RequestMapping(ServiceNameConstants.PATH_ORGANIZATION_PERMISSION)
@Slf4j
public class CyPlatformOrganizationPermissionController extends JeecgController<CyPlatformOrganizationPermission, ICyPlatformOrganizationPermissionService> implements PlatformOrganizationPermissionApi {

    @Autowired
    private ISysPermissionService permissionService;

    @Override
    public List<SysPermission> listModules(Boolean child) {
        return permissionService.listModulesTree(child);
    }

    @Override
    public List<SysPermission> listOrgPermission(String orgId) {
        return this.service.listOrgPermission(orgId);

    }

    @Override
    public List<String> listModuleByOrg(String orgId) {
        return service.listModulesByOrg(orgId);
    }
}
